# import asyncio
import uasyncio

# 定义异步任务1
async def task1():
    print("start task1")
    while 1:
        await uasyncio.sleep_ms(1000)
        print("task1")

# 定义异步任务2
async def task2(param):
    print("start task2")
    while 1:
        await uasyncio.sleep_ms(1000*2)
        print("task2", param)

# 创建事件循环并运行异步任务
async def main():
    print("创建事件循环")
    uasyncio.create_task(task1())
    uasyncio.create_task(task2("=11"))
    while 1:
        await uasyncio.sleep_ms(10_000)

if __name__ == '__main__':
    # 运行主函数, 创建事件循环并运行异步任务
    uasyncio.run(main())